package com.pe1n.yangtaopai.view.activity;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.pe1n.yangtaopai.R;

import java.util.ArrayList;
import java.util.List;

public class FavorableActivity extends AppCompatActivity {
    private ImageView imageView;
    private RecyclerView mRecyclerView;
    private List<Object> mList;
    private Context  mContext;//上下文
    private MyReclerViewAdaper myReclerViewAdaper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_favorable);
        initView();
    }

    private void initView() {
        mList=new ArrayList<>();
        mList.add(new Object());
        mContext=this;
        myReclerViewAdaper=new MyReclerViewAdaper();
        mRecyclerView= (RecyclerView) findViewById(R.id.activity_favorable_RecyclerView);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mRecyclerView.setAdapter( myReclerViewAdaper);
        imageView= (ImageView) findViewById(R.id.activity_favorable_imageViewback_back);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    class MyReclerViewAdaper extends RecyclerView.Adapter<MyReclerViewAdaper.MyViewHolder>{
        @Override
        public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(mContext).inflate(R.layout.favoraboe_layout_item,parent,false);

            return new MyViewHolder(view);
        }

        @Override
        public void onBindViewHolder(MyViewHolder holder, int position) {

        }

        @Override
        public int getItemCount() {
            return mList.size();
        }

        class MyViewHolder extends RecyclerView.ViewHolder{

            public MyViewHolder(View itemView) {
                super(itemView);
            }
        }
    }
}
